<?php

namespace app\api\controller;

use app\api\Controller\Common;
use think\Controller;
use Firebase\JWT\JWT;
class Base extends Common
{
    public function initialize()
    {
        parent::initialize();

        $header=request()->header();
        if(!isset($header['token'])|| empty($header['token'])){
            return json(['code'=>0,'msg'=>'token不存在'])->send();
        }
        $jwt=new JWT();
        $info=$jwt::decode($header['token'],'api123456',['HS256']);
        $this->aid=$info->aid;
    }
}
